-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure Renovate to suggest AGP version bumps #1742
Merged
gabrielfeo
merged 11 commits into
gradle:main
from
gabrielfeo:gf/agp-pre-release-bump-prs
Jan 8, 2025
Merged
Configure Renovate to suggest AGP version bumps #1742
gabrielfeo
merged 11 commits into
gradle:main
from
gabrielfeo:gf/agp-pre-release-bump-prs
Jan 8, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cherry picked from commit 86474cd14f8ea7a4eef7d7705bc8b15f0cb9dd2d)
(cherry picked from commit 994168bcd78831577933c111b9cc1c1dee5cba3b)
gabrielfeo
force-pushed
the
gf/agp-pre-release-bump-prs
branch
2 times, most recently
from
January 6, 2025 12:39
e7a9b26
to
2e4ec1c
Compare
(cherry picked from commit d82c4d7103211d524d4cb4ff8dbb6311ee354ab1)
gabrielfeo
force-pushed
the
gf/agp-pre-release-bump-prs
branch
from
January 6, 2025 14:15
22061a8
to
c2cef72
Compare
Allow unlimited PRs Group changes to versions.json5 Improve renovate.json5 comments
gabrielfeo
force-pushed
the
gf/agp-pre-release-bump-prs
branch
from
January 6, 2025 14:37
c2cef72
to
36964bf
Compare
cdsap
approved these changes
Jan 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome work @gabrielfeo
clayburn
approved these changes
Jan 7, 2025
gabrielfeo
added a commit
that referenced
this pull request
Jan 13, 2025
Since #1742, the `generate_versions` CI job [succeeds even though it can't parse the JSON file][1]. Parsing fails because `jq` [doesn't support JSON5][2]. The job succeeds silently despite this failure because it's ran inside [command substitution][3]. This currently results in #1751 not running proper tests. Fix the `generate_versions` CI job to correctly parse the JSON5 file by stripping comment lines before passing its content to `jq`. Also ensure the job will fail if the step fails by running it once outside command substitution and ensuring `pipefail` is on. This replaces the "debug" step. [1]: https://github.com/gradle/android-cache-fix-gradle-plugin/actions/runs/12717112831 [2]: jqlang/jq#1571 [3]: https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html
gabrielfeo
added a commit
that referenced
this pull request
Jan 15, 2025
In #1742, Renovate was set up with a more usual standard `regex` matcher configuration, which is to search for versions in lines annotated with a comment `// renovate: ...`. However, the `versions.json` file is parsed by several tools which don't support JSON5 or any form of comments, namely Groovy's `json` package and `jq`. Groovy `json` required using a lenient mode (#1742), which may suppress useful validations, while `jq` required stripping the comments beforehand (#1752). Moving away from JSON5 would be a simpler solution. Revert the `versions.json` back from JSON5 to plain JSON and change the Renovate config to match the version properties based on the fact that their values are lists, e.g. `"8.8.0": [`. Matching the version in `gradle.properties` is also simplified to no longer require a comment. Tested with a [dry-run of gradle/renovate-agent][2] against this repo and the Renovate GitHub app against a fork, which created an [example PR][1]. [1]: gabrielfeo#14 (comment) [2]: https://github.com/gradle/renovate-agent/actions/runs/12771500371/job/35598810573
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fully automate the bumping of AGP versions to the latest patch. While there's an existing workflow for bumping the AGP versions in this project, it must be manually triggered specifying the new version. Renovate can fill this gap by suggesting updates whenever new versions come out. Other kinds of bumps are still handled by Dependabot.
Renovate
Renovate is a tool like Dependabot but much more flexible. It has built-in "managers" such as
maven
,gradle
, andpip_requirements
that look for certain patterns in certain files, then query "datasources" for newer versions. No built-in manager supports the customversions.json
file, but Renovate allows for creating a custom regex-based manager.Renovate custom manager
A Renovate config file is added with a custom "regex" manager. This can instruct Renovate to parse any version on any file. The goal is to detect and update AGP versions annotated with a comment:
The "manager" config declares
An example PR is available in a fork: gabrielfeo#10.
The last four elements are commonly set on each comment and captured with regex (example), but I opted to centralize them in the Renovate config to minimize duplication, simplify the comments and the regex that parses them.
Changes
versions.json
with a "renovate: AGP version" commentversions.json5
to keep syntax highlighting support when adding commentsJsonSlurper
s toLAX
mode, which is lenient about comments (Groovy has no support for JSON5)versions.json5
andgradle.properties
too (for the build-time check described below)WorkaroundTest
no longer specifies patch numbers. The existing workflow updated the tests automatically, but it can't be as easily done with Renovate. Thanks to @erichaagdev for this suggestion.gradle.properties
and fail the build if it's missing fromversions.json5
. The goal is to have Renovate create a "nudge" PR if a new major or minor comes out (versions.json5
has major/minor bumps disabled in order to keep older minor versions in the list of "supportedVersions"). The property isn't used for anything else. Thanks to @erichaagdev for this suggestion.These changes were tested running the Renovate GitHub App against a fork. After adding the
dv.json5
preset to the config, which is located in a private Gradle repository, they were tested with dry-runs of our self-hosted Renovate runner, which has access to that repository.